
TO_COMPILE = empty.c toset.c freeset.c bibteco.c copy.c product.c
CC = gcc
CC_LIBS = -lm -pthread
RM = rm -f
RESULT_FILE = set.o
CP = cp
BIN_DIR = /usr/bin

ifdef DIRS
	COMP_FILES = $(patsubst %/,%/*.o,$(DIRS))
	DIROBJ = $(patsubst %/,%,$(DIRS))
	OBJTEXT = $(patsubst %,%_text,$(DIROBJ))
	OBJCLEAN = $(patsubst %,%_clean,$(DIROBJ))
else
	COMP_FILES = 
	DIROBJ = 
	OBJTEXT = 
	OBJCLEAN = 
endif

all: $(OBJTEXT) $(TO_COMPILE)
	$(CC) -shared -o $(RESULT_FILE) $(TO_COMPILE)

$(OBJTEXT):
	$(MAKE) -C $(patsubst %_text,%,$@)/

clean: 
	$(RM) *.o $(RESULT_FILE)

